package com.cec.service.user.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cec.dto.VolunteerDTO;
import com.cec.entity.Volunteer;
import com.cec.mapper.user.VolunteerActivityRegMapper;
import com.cec.result.Result;
import com.cec.service.user.UserVolunteerService;
import com.cec.vo.VolunteerVO;
import org.springframework.stereotype.Service;

@Service
public class UserVolunteerServiceImpl extends ServiceImpl<VolunteerActivityRegMapper,Volunteer> implements UserVolunteerService {
    @Override
    public Result queryOutstandingVolunteer(VolunteerDTO volunteerDTO) {
        QueryWrapper<Volunteer> wrapper = new QueryWrapper<>();
        wrapper.eq("evaluate","优秀")
                .or()
                .eq("evaluate","良好");
        IPage<VolunteerVO> volunteerVOIPage= baseMapper.queryOutstandingVolunteerList(new Page<>(volunteerDTO.getPage(),volunteerDTO.getPageSize()),wrapper);

        return Result.success(volunteerVOIPage.getRecords(),volunteerVOIPage.getTotal());
    }
}
